package com.frejoys.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.frejoys.common.dto.admin.UserLevelMoneyListDto;
import com.frejoys.common.vo.admin.UserLevelMoneyListVo;
import com.frejoys.dao.entity.UserLevelMoney;

import java.util.List;


public interface UserLevelMoneyService extends IService<UserLevelMoney> {

    default UserLevelMoney getOnly(QueryWrapper<UserLevelMoney> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    default UserLevelMoney getOnly(LambdaQueryWrapper<UserLevelMoney> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    /**
     *  没有用户关系推广收益 就添加
     * @param userId  推广用户id
     * @param childUserId 子级用户id
     * @return
     */
    boolean addIfNot(Long userId,Long childUserId);

    // 用户推广收益列表
    IPage<UserLevelMoneyListVo> userLevelMoneyListInfo(UserLevelMoneyListDto dto);
}
